
/**
* @module loginConfig
* @author: Hjava
* @description: 登录模块数据配置项
* @since: 2018-07-16 20:44:21
*/
Object.defineProperty(exports, "__esModule", { value: true });
var constant_1 = __webpack_require__(/*! _util/constant */ "./src/core/utils/constant.ts");
var typeChecker_1 = __webpack_require__(/*! _util/typeChecker */ "./src/core/utils/typeChecker.ts");
var LoginURLConfig = /** @class */ (function () {
    function LoginURLConfig() {
        // WebSocket 和长连接默认地址，0代表默认
        this._config = {
            test: {
                websocket: {
                    0: ['wss.xm.test.sankuai.com'],
                },
                longPolling: {
                    0: ['polling.xm.test.sankuai.com/nx-webpush']
                }
            },
            st: {
                websocket: {
                    0: ['dxlwss.xm.st.sankuai.com']
                },
                longPolling: {
                    0: ['polling.xm.st.sankuai.com/nx-webpush']
                }
            },
            online: {
                websocket: {
                    0: ['wss.neixin.cn'],
                    3: ['wmdxlwss.meituan.com'],
                    4: ['wmdxlwss.meituan.com'],
                    14: ['wmdxlwss.meituan.com'],
                    17: ['wmdxlwss.meituan.com'],
                    36: ['dxlwss.meituan.com'],
                    47: ['dxlwss.meituan.com'],
                    chatRoomURL: ['dxlwss.meituan.com']
                },
                longPolling: {
                    0: ['polling.neixin.cn/sdk-webpush'],
                    1: ['polling.neixin.cn/nx-webpush'],
                    36: ['chatroom.sankuai.com/crwebpush'],
                    chatRoomURL: ['chatroom.sankuai.com/crwebpush']
                }
            }
        };
    }
    LoginURLConfig.prototype.getConfig = function (env, useHTTPS, appId, type, useChatRoomURL) {
        if (env === void 0) { env = constant_1.ENV.ONLINE; }
        if (useHTTPS === void 0) { useHTTPS = false; }
        if (type === void 0) { type = constant_1.CONNECT_TYPE.WEBSOCKET; }
        if (useChatRoomURL === void 0) { useChatRoomURL = false; }
        if (!typeChecker_1.default.isNumber(appId)) {
            appId = 0;
        }
        if (env !== constant_1.ENV.TEST && env !== constant_1.ENV.ST && env !== constant_1.ENV.ONLINE) {
            env = constant_1.ENV.ONLINE;
        }
        var urls = [];
        var urlMap = this._config[env][type];
        if (useChatRoomURL && urlMap['chatRoomURL']) {
            urls = urlMap['chatRoomURL'];
        }
        else if (urlMap[appId]) {
            urls = urlMap[appId];
        }
        else {
            urls = urlMap[0];
        }
        if (env === constant_1.ENV.ONLINE || useHTTPS) {
            if (type === constant_1.CONNECT_TYPE.WEBSOCKET) {
                return urls.map(function (element) {
                    return "wss://" + element;
                });
            }
            if (type === constant_1.CONNECT_TYPE.LONG_POLLING) {
                return urls.map(function (element) {
                    return "https://" + element;
                });
            }
        }
        else {
            if (type === constant_1.CONNECT_TYPE.WEBSOCKET) {
                return urls.map(function (element) {
                    return "ws://" + element;
                });
            }
            if (type === constant_1.CONNECT_TYPE.LONG_POLLING) {
                return urls.map(function (element) {
                    return "http://" + element;
                });
            }
        }
    };
    return LoginURLConfig;
}());
exports.default = new LoginURLConfig();


//# sourceURL=webpack://MTDX/./src/core/login/loginUrlConfig.ts?